<template>
	<div>
	<div class="classifyxq_hz">
		<div
		v-for="(item,index) in golist" :key='index'
		class="classifyxq_nr"
		@click="onclick(item)"
		>
		<img :src="item.pic" />
		{{item.name}}
		
		</div>
	</div>
	</div>
</template>

<script>
	export default {
		data(){
			return{
				golist:[]
			}
		},
		created() {
			var name=this.$route.query.item.name;
			this.$axios.get('https://api.it120.cc/small4/shop/goods/list').then((res=>{
				console.log(res)
				var allGoods=res.data.data;
				allGoods.forEach(item=>{
					if(item.name.includes(name)){
						this.golist.push(item)
					}
				})
			
			}))
			console.log(this.golist)
		},
		methods:{
			onclick(item){
				this.$router.push({path:'/recommend',query:{id:item.id}})
			}
		}
		
	}
</script>

<style scoped>
.classifyxq_hz{
	margin-top: 60px;
	width: 100%;
	height: 600px;
	display: flex;
}
.classifyxq_nr img{
	width: 100%;
	height: 100px;
}
.classifyxq_nr{
	width: 50%;
	height: 200px;
}
</style>